package com.ruoyi.qiushi.service.promotion.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.qiushi.domain.promotion.QiushiNotice;
import com.ruoyi.qiushi.mapper.promotion.QiushiNoticeMapper;
import com.ruoyi.qiushi.service.promotion.IQiushiNoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 公告Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-08
 */
@Service
public class QiushiNoticeServiceImpl implements IQiushiNoticeService {
    @Autowired
    private QiushiNoticeMapper qiushiNoticeMapper;

    /**
     * 查询公告
     *
     * @param id 公告主键
     * @return 公告
     */
    @Override
    public QiushiNotice selectQiushiNoticeById(Long id) {
        return qiushiNoticeMapper.selectQiushiNoticeById(id);
    }

    /**
     * 查询公告列表
     *
     * @param qiushiNotice 公告
     * @return 公告
     */
    @Override
    public List<QiushiNotice> selectQiushiNoticeList(QiushiNotice qiushiNotice) {
        return qiushiNoticeMapper.selectQiushiNoticeList(qiushiNotice);
    }

    /**
     * 新增公告
     *
     * @param qiushiNotice 公告
     * @return 结果
     */
    @Override
    public int insertQiushiNotice(QiushiNotice qiushiNotice) {
        qiushiNotice.setCreateTime(DateUtils.getNowDate());
        return qiushiNoticeMapper.insertQiushiNotice(qiushiNotice);
    }

    /**
     * 修改公告
     *
     * @param qiushiNotice 公告
     * @return 结果
     */
    @Override
    public int updateQiushiNotice(QiushiNotice qiushiNotice) {
        qiushiNotice.setUpdateTime(DateUtils.getNowDate());
        return qiushiNoticeMapper.updateQiushiNotice(qiushiNotice);
    }

    /**
     * 删除公告信息
     *
     * @param id 公告主键
     * @return 结果
     */
    @Override
    public int deleteQiushiNoticeById(Long id) {
        return qiushiNoticeMapper.deleteQiushiNoticeById(id);
    }
}
